﻿<UserControl x:Class="SoftTeach.View.Datenbank.BewertungsschemaDetailView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:softTeach="clr-namespace:SoftTeach"
             mc:Ignorable="d" 
             d:DesignHeight="240" d:DesignWidth="461">
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <GroupBox Grid.Row="1" Header="Prozentbereiche des Bewertungsschemas">
      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="left" Margin="3">
          <Button Command="{Binding Path=AddProzentbereicheCommand}"
                  Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
            <StackPanel Orientation="Horizontal">
              <Grid>
                <Image Source="/SoftTeach;component/Images/Prozentbereich32.png"/>
                <Image Source="/SoftTeach;component/Images/AddOverlay32.png"/>
              </Grid>
              <TextBlock TextWrapping="Wrap" Text="Für jede Zensur hinzufügen" Width="100"/>
            </StackPanel>
          </Button>
          <Label></Label>
          <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Command="{Binding Path=AddProzentbereichCommand}">
            <StackPanel Orientation="Horizontal">
              <Grid>
                <Image Source="/SoftTeach;component/Images/Prozentbereich32.png"/>
                <Image Source="/SoftTeach;component/Images/AddOverlay32.png"/>
              </Grid>
              <TextBlock TextWrapping="Wrap" Text="Für eine Zensur hinzufügen" Width="100"/>
            </StackPanel>
          </Button>
          <Label></Label>
          <Button Name="RemoveButton" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                            Command="{Binding Path=DeleteProzentbereichCommand}">
            <StackPanel Orientation="Horizontal">
              <Grid>
                <Image Source="/SoftTeach;component/Images/Prozentbereich32.png"/>
                <Image Source="/SoftTeach;component/Images/RemoveOverlay32.png"/>
              </Grid>
              <TextBlock TextWrapping="Wrap" Text="Für aktuelle Zensur entfernen" Width="100"/>
            </StackPanel>
          </Button>
        </StackPanel>
        <DataGrid Grid.Row="1" Margin="3" 
                  SelectedItem="{Binding Path=CurrentProzentbereich, Mode=TwoWay}" 
                  ItemsSource="{Binding Path=Prozentbereiche}" 
                  AutoGenerateColumns="False"
                  CanUserAddRows="False">
          <DataGrid.Columns>
            <DataGridComboBoxColumn 
                        Header="Zensur" 
                        ItemsSource="{Binding Source={x:Static softTeach:App.MainViewModel}, Path=Zensuren}"
                        SelectedItemBinding="{Binding Path=ProzentbereichZensur}" 
                        DisplayMemberPath="ZensurNoteMitTendenz"
                        EditingElementStyle="{StaticResource DatagridComboBoxElementStyle}"
                        />
            <DataGridTextColumn Header="von" Binding="{Binding Path=ProzentbereichVonProzent, Converter={StaticResource FloatProzentConverter}}" />
            <DataGridTextColumn Header="bis" Binding="{Binding Path=ProzentbereichBisProzent, Converter={StaticResource FloatProzentConverter}}" />
          </DataGrid.Columns>
        </DataGrid>
      </Grid>
    </GroupBox>
  </Grid>
</UserControl>
